package com.qpf

def range = 1..<5
println("${range} size is ${range.size()} from ${range.from} to ${range.to}")
range = 1..5
println("${range} size is ${range.size()} from ${range.from} to ${range.to}")
println("the element index 2 is ${range[2]}")
println("the element index 2 is ${range.get(2)}")

println("the range contain 4 ? ${range.contains(4)}")
println("sublist: ${range.subList(2,4)}")

range.eachWithIndex{ int entry, int i ->
    print("index: ${i} ==> ${entry} \n")
}

range.each {
    print("${it} ")
}
println()

for (i in range) {
    print("${i} ")
}
println()

def e = 15

switch (e) {
    case 1..<10:
        println("1 ～ 10")
        break
    case 10..<20:
        println("10 ～ 20")
        break
    default:
        println("out of range")
}